#pragma once

#include "CtlSearchEdit.h"
#include "CtlTagList.h"
#include "CtlWordList.h"
#include "CtlButton.h"
#include "DlgTag.h"
#include "DlgRecord.h"

using namespace bdc::ctl;
using namespace bdc::dlg;

#define WND_LIB_TAG_ID 1
#define WND_LIB_WORD_ID 2

// LibWnd

namespace bdc{
	
	namespace wnd{

		class WLibWnd : public CWnd
		{
			DECLARE_DYNAMIC(WLibWnd)

		private:
			CtlSearchEdit searchEdit;
			CtlButton addButton;
			CtlTagList tagList;
			CtlWordList wordList;

			DlgTag tagDialog;
			DlgRecord recordDialog;

		private:
			Gdiplus::Image* pImgSearchBg;
			Gdiplus::Image* pImgSearch;

		private:
			vector<TagInfo*> d_tagList;
			vector<RecordInfo*> d_recordList;

		public:
			WLibWnd();
			virtual ~WLibWnd();

		protected:
			DECLARE_MESSAGE_MAP()

		private:
			afx_msg void OnPaint();
			afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

			//tag handler
			afx_msg void OnModiTag();
			afx_msg void OnDelTag();
			afx_msg void OnClickTagItem(NMHDR * pNotifyStruct, LRESULT * result);
			afx_msg void OnDBClickTagItem(NMHDR * pNotifyStruct, LRESULT * result);
			afx_msg void OnRClickTagItem(NMHDR * pNotifyStruct, LRESULT * result);

			//word handler
			afx_msg void OnModiRecord();
			afx_msg void OnDelRecord();
			afx_msg void OnAddRecord();
			afx_msg void OnDBClickWordItem(NMHDR * pNotifyStruct, LRESULT * result);
			afx_msg void OnRClickWordItem(NMHDR * pNotifyStruct, LRESULT * result);

			//helper function
			void openTagDlg(int index);
			void openRecordDlg(int index);

		public:
			void updateTagList();
			void updateWordList(LONG64 tagId);
		};
	}
}


